package com.chenjiajin.domain;

import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.format.DateTimeFormat;
import com.alibaba.excel.annotation.format.NumberFormat;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.chenjiajin.converter.GenderConverter;
import com.chenjiajin.converter.DateConverter;
import lombok.Data;

import java.io.InputStream;
import java.math.BigDecimal;
import java.net.URL;
import java.util.Date;

/**
 * 导入 easyExcel
 */
@Data
@TableName(value = "demo_easyExcel")
public class DemoImport {
    @TableId(value = "ID", type = IdType.AUTO)
    private Long id;

    @ExcelProperty("名字")
    private String name;

    @ExcelProperty("年龄")
    private Integer age;

    @ExcelProperty("唛头")
    private String mark;

    @ExcelProperty("数量")
    @NumberFormat("##.00")
    private BigDecimal number;

    @ExcelProperty("金额")
    @NumberFormat("##.00")
    private BigDecimal money;

    @ExcelProperty(value = "时间", converter = DateConverter.class)   // 存储时间戳
    private Long depositPayTime;

    @ExcelProperty(value = "时间2")  // 没有@ExcelProperty注解的属性 ,不会被导入数据
    @DateTimeFormat("yyyy-MM-dd HH:mm:ss")  // Date类型 框架有默认的时间转换器
    private Date createTime;



    @ExcelProperty(value = "性别", converter = GenderConverter.class) // 性别 1:男 2:女
    private Integer gender;


    private String img;

    @ExcelProperty(value = "头像")
    private URL imgUrl;

    @ExcelProperty(value = "头像2")
    private InputStream inputStream;

}
